package com.spring.demo6.eg5;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author vhans
 */
@Component
public class InjectService {
    // serviceMap1注入了@Qulifier的value为tag1的所有IService类型的bean
    @Autowired
    @Qualifier("tag1")
    private Map<String, IService> serviceMap1;

    // serviceMap1注入了@Qulifier的value为tag2的所有IService类型的bean
    @Autowired
    @Qualifier("tag2")
    private Map<String, IService> serviceMap2;

    @Override
    public String toString() {
        return "InjectService{" +
                "serviceMap1=" + serviceMap1 +
                ", serviceMap2=" + serviceMap2 +
                '}';
    }
}
